<!DOCTYPE html>
<html>

<head lang="en">
    <title>积分兑换</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <script src="/js/jquery/jquery.min.js"></script>
    <link rel="stylesheet" href="/js/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/strategy.css"/>
    <script src="/js/common.js"></script>
    <script src="/js/checkLogin.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css">
    <script src="/js/plugins/dialog2/dialog.min.js"></script>


    <link rel="stylesheet" href="/js/commodity/More.css">
    <link rel="stylesheet" href="/js/commodity/style.css"/>
    <link rel="stylesheet" href="/js/commodity/Up.css">
    <script type="text/javascript" src="/js/commodity/touch.js"></script>
    <script type="text/javascript" src="/js/commodity/srcolltop.js"></script>
    <script type="text/javascript" src="/js/commodity/timer.js"></script>
    <script type="text/javascript" src="/js/commodity/xlmenu.js"></script>

    <script>
        $(function () {
            //每周推荐回显
            $.get(baseUrl+'/products', {pageSize: 0, putAwayState: 1}, function (data) {
                $("#travelsCommends").renderValues(data, {
                    'getHref': getHref
                });
                $(".carousel-item:first").addClass('active');
            })

            //获取一条攻略推荐数据
            $.get(baseUrl+'travelCommonds', {type: 3, pageSize: 1}, function (data) {
                //渲染数据
                $(".commend").renderValues(data.list[0], {
                    getHref: getHref
                });
            });

            //获取所有的状态为推荐的攻略
            $.get(baseUrl+'/products', {pageSize: 0, putAwayState: 1}, function (data) {
                $(".strategyCommend").renderValues(data, {
                    getHref: getHref,
                    getPrice:function (item, value) {
                        $(item).html("¥"+value)
                    }
                });
            });

            //地区id
            var regionId;



            //获取全部攻略(分页)
            //当前页
            var currentPage = 2;
            //总页数
            var pages = 2;

            function query() {
                if (regionId) {
                    //获取json数据
                    $.get(baseUrl + '/regions/' + regionId + '/strategies', {currentPage: currentPage}, function (data) {
                        $.each(data.list, function (index, ele) {
                            //克隆
                            var div = $("#template .mb").clone(true);
                            //设置a连接地址
                            div.find("a").attr('href', '/strategyCatalogs.html?id=' + ele.id);
                            div.find("img").attr('src', ele.coverUrl);
                            div.find("span").html(ele.title);
                            $(".classify").append(div);
                        });
                        pages = data.pages;
                    }, "json")
                    currentPage = currentPage + 1;
                }

            }

            //给window绑定滚动事件
            $(window).scroll(function () {
                if ($(window).height() + $(document).scrollTop() + 1 >= $(document).height()) {
                    //如果是大于总页数就不发送请求了
                    if (currentPage <= pages) {
                        query();
                    } else {
                        $(document).dialog({
                            type: 'notice',
                            infoIcon: '../img/icon/loading.gif',
                            infoText: '不要拉了,再拉就出屎了!',
                            autoClose: 1000
                        });
                    }
                }
            });

        })
    </script>
</head>
<style>

    .a1{height: 200px;}
    .a2{width: 50px;height: 15px;background-color: orangered;color: white;font-size: 14px;margin-left: 5px;}

</style>
<body>

<div id="template" style="display: none">
    <div class="col-6 mb">
        <a>
            <img class="float-left">
            <div class="classify-text">
                <span></span>
                <p>0人收藏</p>
            </div>
        </a>
    </div>
</div>

<div class="search-head">
    <div class="row nav-search" >
        <div class="col-2">
            <a href="profiles.html">
                <span><i class="fa fa-chevron-left fa-2x"></i></span>
            </a>
        </div>
        <div class="col-10">
            <div class="input-group-sm search">
                <input class="form-control searchBtn" placeholder="查找商品关键字">
            </div>
        </div>
    </div>
</div>

<ul class="nav nav-pills nav-justified border border-left-0 border-top-0 border-right-0" id="pills-tab" role="tablist">

    <li class="nav-item">
        <a class="nav-link active show" data-toggle="pill" href="#pills-top">
            <span align="left" >积分兑换商城</span>
        </a>
    </li>

</ul>

<div class="tab-content" id="pills-tabContent">
    <div class="tab-pane fade active show" id="pills-top">
        <div id="carouselExampleControls" class="carousel slide" data-ride="carousel">

            <div id="travelsCommends">
                <div class="carousel-inner" render-loop="list">
                    <div class="carousel-item">
                        <a render-key="list.id" render-fun="getHref" data-url="productData.html?id=">
                            <img class="d-block w-100" render-src="list.imgUrl" width="100%" height="200px">
                            <span class="recommend" render-html="list.name" style="color: black;font-size: 14px;"></span><br>
                            <span class="recommend" render-html="list.intro" style="color: #5a6268;font-size: 12px;"></span></a>
                    </div>
                </div>
            </div>

            <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
                <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                <span class="sr-only"></span>
            </a>
            <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
                <span class="carousel-control-next-icon" aria-hidden="true"></span>
                <span class="sr-only"></span>
            </a>
        </div>

        <hr>
        <div class="container strategyCommend">
            <h6>全部兑换</h6>
            <div class="row hot" render-loop="list">
                <div class="col-6 a1">
                    <a render-key="list.id" render-fun="getHref" data-url="productData.html?id=">
                        <img render-src="list.imgUrl" style=" height:105px">
                        <span render-key="list.price" render-fun="getPrice" align="left" style="color: red;font-size: 13px;"></span><em class="a2">包邮</em><br>
                        <span render-html="list.name" align="left" style="color: black;font-size: 14px;"></span><br>
                        <span render-html="list.intro" align="left" style="color: #5a6268;font-size: 12px;"></span>
                    </a>
                </div>
            </div>
        </div>
    </div>
    <div class="wx_nav" id="wx_nav">
        <a href="/index.html"  id="nav_index">首页</a>
        <a href="shoppingCar.html" class="glyphicon glyphicon-shopping-cart" id="nav_shopcart">购物车</a>
        <a href="spdd.html"  id="nav_me on">订单</a>
    </div>
</div>
   <!-- <div class="operation wx_nav" id="wx_nav">
        <button class="btn" onclick="window.history.go(-1)">放弃评价</button>
        <button class="btn" id="submitBtn">提交评价</button>
        <button class="btn" id="b">提交评价</button>
    </div>-->
</div>
</body>
</html>